package com.vogue.supplymall.upload.domain.service;

import com.vogue.supplymall.common.domain.dto.UploadInfo;
import com.vogue.supplymall.common.exception.UploadException;

/**
 * The type Upload service.
 *
 * @aouthor: zhangliang
 * @date: Create in 2018-03-20
 */
public interface UploadService {

    /**
     * 临时存储文件路径（定期删除此目录下文件）
     */
    public String TEMP_PATH = "temp";

    /**
     * 删除已上传的文件
     *
     * @param uploadInfo the upload info
     * @return boolean
     */
    public Boolean removeResource(UploadInfo uploadInfo);

    /**
     * 删除已上传的文件
     *
     * @param url 文件的上传路径
     * @return boolean
     */
    public Boolean removeResource(String url);

    /**
     * 上传文件到服务器并返回上传后的url
     *
     * @param uploadInfo the upload info
     * @return string
     * @throws UploadException the upload exception
     */
    public String uploadResource(UploadInfo uploadInfo) throws UploadException;

    /**
     * 移动文件到指定的新目录下
     *
     * @param targetpath 目标文件路径及文件名
     * @param sourcepath 被移动的文件路径及文件名
     * @throws UploadException the upload exception
     */
    public void moveResource(String targetpath, String sourcepath) throws UploadException;

    /**
     * 赋值文件到指定的新目录下
     *
     * @param targetpath 目标文件路径及文件名
     * @param sourcepath 被赋值的文件路径及文件名
     * @throws UploadException the upload exception
     */
    public void copyResource(String targetpath, String sourcepath) throws UploadException;
}
